<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Setting - Deductible</title>

<link rel="stylesheet" href="<c:url value="/css/tableStyle.css"/>" />

<script>

	window.onload = function(){
		document.getElementById("openI").onclick = openI;
		document.getElementById("ResetI").onclick = ResetI;
	};
	
	function openI(){
		document.getElementById("hidden").hidden = false;
	};
	function ResetI(){
		document.getElementById("hidden").hidden = true;
	};
	
</script>

</head>
<body>
<h1>Deductible List ${fn:length(models)}</h1>

<s:form action="deductible" namespace="/setting" method="post">
<input class="button1" type="button" id="openI" value="新增"/>
<tr>
<td style="text-align: right"><label>CODE:</label>
	<input type="text" size="10" name="searchBox" value="${searchBox}"/>
	<s:submit cssClass="button" value="搜尋" method="search" /></td>
</tr>	
</s:form>

<table>
	<thead>
		<tr>
			<th>FUNCTION</th>
			<th>ID</th>
			<th>CODE</th>
			<th>NAME</th>
			<th>RATE</th>
			<th>MINTSI</th>
			<th>MAXTSI</th>
			<th>LOCATION</th>
			<th>Creator</th>
			<th>CreateTime</th>
			<th>Modifier</th>
			<th>ModifiedTime</th>
		</tr>
	</thead>
	<s:form action="deductible" namespace="/setting" method="post">
	<tr id="hidden" hidden="true">	
		<td><s:submit cssClass="button1" value="送出" method="insert"/>
			<input class="button1" type="button" value="取消" id="ResetI"></td>
		<td><input disabled="disabled" type="text" size="5" name="model.id" value=""/></td>
			<td><input type="text" size="5" name="model.code" value=""/></td>
			<td><input type="text" size="10" name="model.name" value=""/></td>
			<td><input type="text" size="5" name="model.rate" value=""/></td>
			<td><input type="text" size="10" name="model.mintsi" value=""/></td>
			<td><input type="text" size="10" name="model.maxtsi" value=""/></td>
			<td><input type="text" size="10" name="model.location" value=""/></td>
			<td><input disabled="disabled" type="text" size="8" name="model.creator" value=""/></td>
			<td><input disabled="disabled" type="text" size="15" name="model.createTime" value=""/></td>
			<td><input disabled="disabled" type="text" size="8" name="model.modifier" value=""/></td>
			<td><input disabled="disabled" type="text" size="15" name="model.modifiedTime" value=""/></td>
	</tr>
	</s:form>
	<c:if test="${not empty models}">
	<tbody>
		<c:forEach items="${models}" var="item" varStatus="status">
		<s:form action="deductible" namespace="/setting" method="post">
		<tr>
			<td>
				<s:submit cssClass="button" value="修改" method="update" />
				<s:submit cssClass="button" value="刪除" method="delete" />
			</td>
			<td><input type="text" size="5" name="model.id" value="${item.id}"/></td>
			<td><input type="text" size="5" name="model.code" value="${item.code}"/></td>
			<td><input type="text" size="10" name="model.name" value="${item.name}"/></td>
			<td><input type="text" size="5" name="model.rate" value="${item.rate}"/></td>
			<td><input type="text" size="10" name="model.mintsi" value="${item.mintsi}"/></td>
			<td><input type="text" size="10" name="model.maxtsi" value="${item.maxtsi}"/></td>
			<td><input type="text" size="10" name="model.location" value="${item.location}"/></td>
			<td><input type="text" size="8" name="model.creator" value="${item.creator}"/></td>
				<joda:format var="createTimeJoda" value="${item.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
			<td><input type="text" size="20" name="model.createTime" value="${createTimeJoda}"/></td>
			<td><input type="text" size="8" name="model.modifier" value="${item.modifier}"/></td>
				<joda:format var="createTimeJoda" value="${item.modifiedTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
			<td><input type="text" size="20" name="model.modifiedTime" value="${createTimeJoda}"/></td>
				
		</tr>
		</s:form>
		</c:forEach>
	</tbody>
	</c:if>
</table>

</body>
</html>